/**
 * This function checks submits a form 
 *
 ***************************************************************
 *  Example
 **************************************************************
 * // attach this even handler onto the submit event for form 
 * $( "#form" ).submit( login_submit_event );
 *  
 **************************************************************
 *
 * @author nicholas malacarne <nicholas.malacarne@gmail.com>
 */

function login_submit_event( event ){
    
    // username and password values -nm
    var data = { username: null, password: null };
    
   // prevent default action of event -nm
   event.preventDefault();
   
   if ( $.inputOK() ){
       
       data.username = $( '#username' ).val();
       data.password = hex_md5( $( '#password' ).val() );
       
       login_ajax( data ).done( function(){
           
           // reload page -nm
           location.reload(true);
       } );
   }
};